﻿<UserControl x:Class="Renci.Wwt.DataManager.Views.DataSourceInfoItemView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseLeftButtonUp">
            <i:InvokeCommandAction x:Name="MouseLeftButtonUp" Command="{Binding Path=SelectDataSourceInfoCommand, Mode=OneWay}"  CommandParameter="{Binding }" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <UserControl.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Filters">
                <MenuItem Header="Add" ItemsSource="{Binding Filters}" >
                    <MenuItem.ItemContainerStyle>
                        <Style TargetType="MenuItem">
                            <Setter Property="Header" Value="{Binding Name}"/>
                            <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.AddDataSourceFilterCommand}"/>
                            <Setter Property="CommandParameter" Value="{Binding}"/>
                        </Style>
                    </MenuItem.ItemContainerStyle>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="Properties" Command="{Binding SelectDataSourceInfoCommand}" CommandParameter="{Binding }" />
        </ContextMenu>
    </UserControl.ContextMenu>
    <TextBlock HorizontalAlignment="Stretch" Text="{Binding DataSourceInfo.Name}" />
</UserControl>
